<script type="text/javascript">
    var url = "ajax.column.php";
    function delcolumn(id) {
        if ( confirm(' 确定删除这个版块! ') ) {
            $.ajax({
				type: "POST",
				url: url,
				data:   "op=delcolumn&cid=" + id,
				success: function(msg){ 
					window.location.reload();
				} 
			}); 
        }
    }
    function view(id,status) {
        if ( status == 'o' ) {
            $("#item_" + id ).hide();
            $("#box_" + id ).show();
        } else if ( status == 'c' ) {
            $("#item_" + id ).show();
            $("#box_" + id ).hide();
        } else if ( status == 's' ) {
            var val = $("input[name=column_name_" + id + "]").val();
            if ( $.trim(val) ) {
                $.ajax({
    				type: "POST",
    				url: url,
    				data:   "op=savecolumn&cid=" + id + "&column_name=" + val,
    				success: function(msg){ 
    					if ( msg ) {
    					    $("#item_a_" + id ).html(msg);
    					    $("#item_" + id ).show();
                            $("#box_" + id ).val(msg).hide();
    					}
    				} 
    			}); 
            }
        }
    }
</script>
<div style="border-bottom: 1px solid #c8d2f0; padding: 5px 10px;"><strong>群组分版设置</strong></div>
<div style="padding: 10px 0;">
    <table width="100%" cellspacing="0">
        <tr>
            <td>
                <form name="<{$form.name}>" id="<{$form.name}>" action="<{$form.action}>" method="<{$form.method}>">
                   <{foreachq item=item from=$form.elements}>
                		<{$item.caption}> <{$item.body}>
                   <{/foreach}>
                </form>
            </td>
        </tr>
    </table>
</div>

<table width="100%" cellspacing="0">
	<tr>
		<th width="60%" align="left"><div style="padding: 3px;">版块</div></th>
		<th>&nbsp;</th>
	</tr>
	<{foreachq item=item from=$column_list}>
	<tr class="<{cycle values='odd, even'}>">
		<td>
    		<div style="padding: 3px;" id="item_<{$item.column_id}>">
    		  <a href="groups.php?op=forum&amp;gid=<{$groupinfo.group_id}>&amp;cid=<{$item.column_id}>" id="item_a_<{$item.column_id}>"><{$item.column_name}></a> <small>(<{$item.counts}>)</small>
    		</div>
    		<div style="padding: 3px; display: none;" id="box_<{$item.column_id}>" >
        		  <input type="text" name="column_name_<{$item.column_id}>" value="<{$item.column_name}>" />
        		  <input type="button" name="submit" value="保存" onclick="javascript:view('<{$item.column_id}>','s')" />
        		  <input type="button" name="submit" value="取消" onclick="javascript:view('<{$item.column_id}>','c')" />
    		</div>
		</td>
		<td align="right">
		     <a href="javascript:view('<{$item.column_id}>','o')"><{$smarty.const._EDIT}></a> | 
		     <a href="javascript:delcolumn('<{$item.column_id}>')"><{$smarty.const._DELETE}></a>
		</td>
	</tr>
	<{/foreach}>
</table>

